#ifndef RTDEBUG_H
#define RTDEBUG_H

#include "RtTrace.h"

#define RT_LOG_MODULE_TRACE 0

#ifndef RT_DISABLE_TRACE

//
// Parameters Descriptions:
//   [module] module number, unsigned int type;
//   [desc  ] module description that will be displayed in log output to tell which module 
//            it belong to, const char* type, must be less than 64 bytes in length;
//   [str   ] log content, const char* type;
//
#define RT_LOG_REGISTER_MODULE(module, desc)	CRtLog::Instance()->RegisterModule(module, desc)

#define RT_ERROR_LOG(module, str)			RT_LOG(RT_LOG_LEVEL_ERROR, module, str)
#define RT_WARNING_LOG(module, str)			RT_LOG(RT_LOG_LEVEL_WARNING, module, str)
#define RT_INFO_LOG(module, str)			RT_LOG(RT_LOG_LEVEL_INFO, module, str)
#define RT_STATE_LOG(module, str)			RT_LOG(RT_LOG_LEVEL_STATE, module, str)
#define RT_FUNC_LOG(module, str)			CRtFuncLog theFUNCTRACE(module, str);

#define RT_ERROR_LOG_THIS(module, str)		RT_LOG(RT_LOG_LEVEL_ERROR, module, str << " this=" << this)
#define RT_WARNING_LOG_THIS(module, str)	RT_LOG(RT_LOG_LEVEL_WARNING, module, str << " this=" << this)
#define RT_INFO_LOG_THIS(module, str)		RT_LOG(RT_LOG_LEVEL_INFO, module, str << " this=" << this)
#define RT_STATE_LOG_THIS(module, str)		RT_LOG(RT_LOG_LEVEL_STATE, module, str << " this=" << this)

/*-----------------------------------------------------------------------------------*/

#define RT_ERROR_TRACE(str)			RT_ERROR_LOG(RT_LOG_MODULE_TRACE, str)
#define RT_WARNING_TRACE(str)		RT_WARNING_LOG(RT_LOG_MODULE_TRACE, str)
#define RT_INFO_TRACE(str)			RT_INFO_LOG(RT_LOG_MODULE_TRACE, str)
#define RT_STATE_TRACE(str)			RT_STATE_LOG(RT_LOG_MODULE_TRACE, str)
#define RT_FUNC_TRACE(str)  		CRtFuncLog theFUNCTRACE(RT_LOG_MODULE_TRACE, str);

#define RT_ERROR_TRACE_THIS(str)	RT_ERROR_TRACE(str << " this=" << this)
#define RT_WARNING_TRACE_THIS(str)	RT_WARNING_TRACE(str << " this=" << this)
#define RT_INFO_TRACE_THIS(str)		RT_INFO_TRACE(str << " this=" << this)
#define RT_STATE_TRACE_THIS(str)	RT_STATE_TRACE(str << " this=" << this)


#else//!RT_DISABLE_TRACE

#define RT_LOG_REGISTER_MODULE(module, desc) 

#define RT_ERROR_LOG(module, str)
#define RT_WARNING_LOG(module, str)
#define RT_INFO_LOG(module, str)
#define RT_STATE_LOG(module, str)
#define RT_FUNC_LOG(module, str)

#define RT_ERROR_LOG_THIS(module, str)
#define RT_WARNING_LOG_THIS(module, str)
#define RT_INFO_LOG_THIS(module, str)
#define RT_STATE_LOG_THIS(module, str)

/*-----------------------------------------------------------------------------------*/

#define RT_ERROR_TRACE(str) 
#define RT_WARNING_TRACE(str) 
#define RT_INFO_TRACE(str) 
#define RT_STATE_TRACE(str) 
#define RT_FUNC_TRACE(str) 

#define RT_ERROR_TRACE_THIS(str) 
#define RT_WARNING_TRACE_THIS(str) 
#define RT_INFO_TRACE_THIS(str) 
#define RT_STATE_TRACE_THIS(str) 

#endif // RT_DISABLE_TRACE


#define RT_DIAGNOSE_TRACE(str)	

#endif // RTDEBUG_H
